package com.sunrise.xdoc.entity.operator;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.Length;

import com.sunrise.xdoc.entity.AbstractCodeEntity;

@Entity
@Table(name = "op_function")
@Inheritance(strategy = InheritanceType.JOINED)
public class Function extends AbstractCodeEntity {
	private static final long serialVersionUID = 8945705601425703473L;
	private Module module;
	private String name;
	private String possibleMode; // "CRUDE"
	private boolean active;

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "module_id")
	public Module getModule() {
		return module;
	}

	public void setModule(Module module) {
		this.module = module;
	}

	@Column(name = "name")
	@Length(max = 250)
	@NotNull
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "possible_mode")
	public String getPossibleMode() {
		return possibleMode;
	}

	public void setPossibleMode(String possibleMode) {
		this.possibleMode = possibleMode;
	}

	@Column(name = "active")
	public boolean isActive() {
		return active;
	}

	public void setActive(boolean active) {
		this.active = active;
	}

}
